ActionController::Routing::Routes.draw do |map|
    
    map.resources :users do |user|
        user.resources :allowed_websites
    end
        
    map.resources :paths do |paths|
      paths.resources :steps
    end
    
    # The priority is based upon order of creation: first created -> highest priority.
    
    # Sample of regular route:
    # map.connect 'products/:id', :controller => 'catalog', :action => 'view'
    # Keep in mind you can assign values other than :controller and :action
    
    # Sample of named route:
    # map.purchase 'products/:id/purchase', :controller => 'catalog', :action => 'purchase'
    # This route can be invoked with purchase_url(:id => product.id)
    
    # You can have the root of your site routed by hooking up '' 
    # -- just remember to delete public/index.html.
    # map.connect '', :controller => "welcome"
    
    # Allow downloading Web Service WSDL as a file with an extension
    # instead of a file named 'wsdl'
    map.connect ':controller/service.wsdl', :action => 'wsdl'
    
    # default pages
    map.connect '', :controller => 'default', :action => 'index'
    map.connect '/about', :controller => 'default', :action => 'about'
    map.connect '/contact', :controller => 'default', :action => 'contact'
    
    # login
    map.connect 'logged_in', :controller => 'users', :action => 'logged_in'
    map.connect 'not_authorized', :controller => 'users', :action => 'not_authorized'
    map.connect 'forgot_password', :controller => 'users', :action => 'forgot_password'
    map.connect 'reset_password', :controller => 'users', :action => 'reset_password'
    map.connect 'signup', :controller => 'users', :action => 'signup'
    map.connect 'login', :controller => 'users', :action => 'signin'
    map.connect 'signin', :controller => 'users', :action => 'signin'
    map.connect 'signout', :controller => 'users', :action => 'signout'
    map.connect 'logout', :controller => 'users', :action => 'signout'
    map.connect 'change_password', :controller => 'users', :action => 'change_password'
    map.connect 'welcome', :controller => 'users', :action => 'welcome'
    map.connect 'activate', :controller => 'users', :action => 'activate'
    map.connect 'check_email', :controller => 'users', :action => 'check_email'
    map.connect 'api_key', :controller => 'users', :action => 'api_key'
    
    #paths
    map.connect '/close_popup', :controller => 'paths', :action => 'close_popup'
    map.connect 'paths/update_path_order', :controller => 'paths', :action => 'update_path_order'
    map.connect 'paths/delayed_browse/:id', :controller => 'paths', :action => 'delayed_browse'
#    map.connect 'paths/change_visibility', :controller => 'paths', :action => 'change_visibility'
#    map.connect 'paths/browse/:id', :controller => 'paths', :action => 'browse'
#    map.connect 'paths/follow/:id', :controller => 'paths', :action => 'follow'
#    map.connect 'paths/current/:id', :controller => 'paths', :action => 'current'
    
    # trails
    map.connect 'trails/add', :controller => 'trail', :action => 'add'
    map.connect 'trails/edit', :controller => 'trail', :action => 'edit'
    map.connect 'trail/browse/:id', :controller => 'trail', :action => 'browse'
    map.connect 'trails/browse/:id', :controller => 'trail', :action => 'browse'
    
    # search
    map.connect 'search/relations.:format/*terms', :controller => 'search', :action => 'relations'
    map.connect 'search/uris.:format/*terms', :controller => 'search', :action => 'uris'
    map.connect 'search/uris/*terms', :controller => 'search', :action => 'uris'
    map.connect 'search/search_results.:format/*terms', :controller => 'search', :action => 'search_results'
    map.connect 'search/search_results/*terms', :controller => 'search', :action => 'search_results'
    
    # Install the default route as the lowest priority.
    map.connect ':controller/:action/:id.:format'
    map.connect ':controller/:action/:id'
    
end
